/**
 * components/Row.js
 * Define your component using platform-independent primitives
 */
import React from "react";

import { View, StyleSheet, Text } from "react-native";
import PropTypes from "prop-types";
import { isEmpty } from "../../utils/utils";
import {
  Color, ScreenWidth, scale, FontSize,
} from "../../common/index";

const CommonRowItem = props => {
  const { name, value } = props;
  return isEmpty(value) ? null : (
    <View style={styles.rowItemContainer}>
      <Text style={styles.textName}>{name}</Text>
      <Text style={styles.textValue}>{value}</Text>
    </View>
  );
};

CommonRowItem.propsTypes = {
  name: PropTypes.string.isRequired,
  value: PropTypes.string.isRequired,
};

const styles = StyleSheet.create({
  rowItemContainer: {
    width: ScreenWidth,
    paddingVertical: scale * 8,
    flexDirection: "row",
    paddingHorizontal: scale * 16,
  },
  textName: {
    width: scale * 70,
    fontSize: FontSize.SIZE_14,
    color: Color.text_assist,
    marginRight: scale * 16,
  },
  textValue: {
    fontSize: FontSize.SIZE_14,
    color: Color.text_content,
    flex: 1,
  },
});

export default CommonRowItem;
